import 'package:flutter_elf/_base/common_scaffold_list.dart';
/// CreateTime 2020/4/22 9:55
/// CreateUser chen 
/// ProjectName flutter_elf
import 'package:flutter_elf/config/component_index.dart';
import 'package:flutter_elf/model/gank_io_girl_response.dart';
import 'package:flutter_elf/network/service/gank_io_service.dart';

class GankIOPage extends BaseWidget{
  @override
  BaseWidgetState<BaseWidget> getState() {
    // TODO: implement getState
    return GankIOPageState();
  }
}

class GankIOPageState extends BaseWidgetState<GankIOPage>{

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    if(mounted){
      NavigatorUtils.navigatorReplaceRouter(context, CommonListPage<WidgetItem,GankIOGirlResponse,GankIOGirlData> (
        title: '哈哈,我要测试',
        top: Text('标题'),
        getItem: (dynamic info){
          return WidgetItem<GankIOGirlData>(info);
        },
        limit: 20,
        futureData: (int page){
          return futureData(page);
        },
      ));
    }
  }

  Future<GankIOGirlResponse> futureData(int page){
    return GankIOService.getCategory(page, state: this);
  }

  @override
  Widget buildView(BuildContext context) {
    // TODO: implement buildView
    return null;
  }

  @override
  PreferredSizeWidget initAppbar() {
    // TODO: implement initAppbar
    return AppBarCreator.create(context, 'gank io');
  }
}